package com.providerlib.fileprovider;

import android.content.Context;
import android.net.Uri;
import android.os.Build;

import java.io.File;

/**
 * Created by zhanghongyang01 on 17/5/31.
 */

public class FileProvider7 {

    public static Uri getUriForFile(Context context, File file) {
        Uri fileUri = null;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            fileUri = getUriForFile24(context, file);
        } else {
            fileUri = Uri.fromFile(file);
        }
        return fileUri;
    }

    private static Uri getUriForFile24(Context context, File file) {
        return LibFileProvider.getUriForFile(context, context.getPackageName() + ".libfileprovider", file);
    }

    public static String getFileProviderName(Context context) {
        return context.getPackageName()+".libfileprovider";
    }
}
